<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<link rel="stylesheet" type="text/css"
		href="../../resources/estilo.css" />
	<title>Gerenciamento de Funcionarios!</title>
</h:head>

<h:body>
	<ui:include src="menu.xhtml" />

	<div id="table">
		<h:form>

			<p:dataTable value="#{turmaManager.turmas}" var="turma"
				paginator="true" rows="10">


				<p:column>
					<f:facet name="header">
						<h:outputText value="Curso" />
					</f:facet>

					<h:outputText id="curso" value="#{turma.curso.nome}" />
				</p:column>

				<p:column>
					<f:facet name="header">
						<h:outputText value="Dia" />
					</f:facet>
					<h:outputText value="#{turma.diaSemana}" />
				</p:column>

				<p:column style="width: 45px;">
					<f:facet name="header">
						<h:outputText value="Inicio" />
					</f:facet>
					<h:outputText value="#{turma.dataInicio}" />
				</p:column>

				<p:column style="width: 45px;">
					<f:facet name="header">
						<h:outputText value="Conclusão" />
					</f:facet>
					<h:outputText value="#{turma.dataConclusao}" />
				</p:column>
				<p:column style="width: 20px;">
					<f:facet name="header">
						<h:outputText value="Vagas" />
					</f:facet>
					<h:outputText value="#{turma.numeroVagas}" />
				</p:column>
				
				<p:column>
					<f:facet name="header">
						<h:outputText value="Inscritos" />
					</f:facet>
					<p:commandButton action="#{turmaManager.direciona(turma.id)}"
						value="ver Alunos" ajax="false" />
				</p:column>
				
				
			</p:dataTable>
		</h:form>
	</div>

	<p:dialog header="Lista de alunos" widgetVar="dialogGerAluno"
		width="500" height="560" resizable="false" showEffect="slide">
		<h:form id="cadluno">
			<h:panelGrid columns="2" cellpadding="5">
				<h:outputText value="Nome: " />
				<p:inputText value="#{alunoManager.aluno.nome}" />
				<h:outputText value="Sobrenome: " />
				<p:inputText value="#{alunoManager.aluno.sobrenome}" />
				<h:outputText value="Data Nascimento: " />
				<p:inputMask value="#{alunoManager.aluno.dtNascimento}"
					mask="99/99/9999" />
				<h:outputText value="E-mail: " />
				<p:inputText value="#{alunoManager.aluno.email}" />
				<h:outputText value="Login: " />
				<p:inputText value="#{alunoManager.aluno.login}" />
				<h:outputText value="Senha: " />
				<p:inputText value="#{alunoManager.aluno.senha}" />
				<h:outputText value="Sexo: " />
				<h:selectOneRadio value="#{alunoManager.aluno.sexo}">
					<f:selectItem itemValue="M" itemLabel="Masculino" />
					<f:selectItem itemValue="F" itemLabel="Feminino" />
				</h:selectOneRadio>

				<h:outputText value="Matricula: " />
				<p:inputMask value="#{alunoManager.aluno.matricula}" mask="999" />

				<h:outputText value="Turma: " />
				<h:selectOneMenu id="codigoTurma" value="#{alunoManager.turmaId}">
					<f:selectItem itemLabel="selecione uma turma" itemValue="null" />
					<f:selectItems value="#{alunoManager.listarTurmas}" var="turmas"
						itemLabel="#{turmas.numeroVagas}" itemValue="#{turmas.id}" />
				</h:selectOneMenu>

				<h:outputText value="CPF: " />
				<p:inputMask value="#{alunoManager.aluno.cpf}" mask="999.999.999-99" />

				<h:outputText value="Estado: " />
				<h:selectOneMenu value="#{alunoManager.endereco.estado}">
					<f:selectItem itemLabel="Selecione o estado" itemValue="null" />
					<f:selectItem itemLabel="CE" itemValue="ce" />
					<f:selectItem itemLabel="PE" itemValue="pe" />
					<f:selectItem itemLabel="RN" itemValue="rn" />
				</h:selectOneMenu>

				<h:outputText value="Cidade: " />
				<p:inputText value="#{alunoManager.endereco.cidade}" />

				<h:outputText value="Bairro: " />
				<p:inputText value="#{alunoManager.endereco.bairro}" />

				<h:outputText value="Logradouro: " />
				<p:inputText value="#{alunoManager.endereco.logradouro}" />

				<h:outputText value="Numero: " />
				<p:inputText value="#{alunoManager.endereco.numero}" />

				<h:outputText value="complemento: " />
				<p:inputText value="#{alunoManager.endereco.complemento}" />

				<h:commandButton value="Salvar" action="#{alunoManager.save}" />
			</h:panelGrid>
		</h:form>
	</p:dialog>

</h:body>
</html>